<?php

 class Phivchh_model extends CI_Model{
     private $tbl='PHIVCHH';
             function __construct() {
         parent::__construct();
     }
     function load_by_loaive($loaive){
        if ($loaive==3) $loaive='SAV';
        else if($loaive==2) $loaive='VIP';
        else $loaive='PT';
        
        $DB=$this->load->database('khachhang',TRUE);
        $DB->from($this->tbl);
        $DB->where('LOAIVE',$DB->escape($loaive));
        $DB->order_by('THOIDIEMAPDUNG','DESC');
        return $DB->get();
     }
     function load_by_id($MSPHH) {
         $DB=$this->load->database('khachhang',TRUE);
         return $DB->get_where($this->tbl,array('MSPHH'=>$MSPHH));
     }
 }

